<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<html>
<head>
    <meta charset="UTF-8">
    <title>...</title>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"
          integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">

    <!-- 可选的 Bootstrap 主题文件（一般不用引入） -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap-theme.min.css"
          integrity="sha384-6pzBo3FDv/PJ8r2KRkGHifhEocL+1X2rVCTTkUfGk7/0pbek5mMa1upzvWbrUbOZ" crossorigin="anonymous">

    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"
            integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd"
            crossorigin="anonymous"></script>
    <script src="js/jquery.min.js"></script>
    <script src="js/jquery.params.js"></script>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        #book,#discount{
            border: 1px solid dodgerblue;
            text-align: center;
        }
        #discount{
            margin-top: 20px;
        }
        #book td{
            border: 1px solid dodgerblue;
            width: 100px;
        }
        #book td b{
            color: white;
        }
        #discount td{
            border:1px solid dodgerblue;
            width: 300px;
        }
        #discount td b{
            color: white;
        }
    </style>
</head>
<body>
<table id="book">
    <tr><td colspan="9" bgcolor="#1e90ff" align="left"><b>图书管理</b></td></tr>
    <tr>
        <td>序号</td>
        <td>图书名称</td>
        <td>图书作者</td>
        <td>出版社</td>
        <td>图书价格</td>
        <td>折扣</td>
        <td>折后价格</td>
        <td>库存数量</td>
        <td>操作</td>
    </tr>
    <tbody id="tb"></tbody>
</table>
<table id="discount">
    <tr><td colspan="3" bgcolor="#1e90ff" align="left"><b>图书管理</b></td></tr>
    <tr>
        <td>图书条码：</td>
        <td align="left"><input type="text"></td>
        <td></td>
    </tr>
    <tr>
        <td>图书名称：</td>
        <td align="left"><input type="text"></td>
        <td></td>
    </tr>
    <tr>
        <td>作者：</td>
        <td align="left"><input type="text"></td>
        <td></td>
    </tr>
    <tr>
        <td>出版社：</td>
        <td align="left"><input type="text"></td>
        <td></td>
    </tr>
    <tr>
        <td>图书数量：</td>
        <td align="left"><input type="text"></td>
        <td></td>
    </tr>
    <tr>
        <td>价格：</td>
        <td align="left"><input type="text"></td>
        <td></td>
    </tr>
    <tr>
        <td>折扣：</td>
        <td align="left">
            <select name="" id="xz">
                <option value="无折扣">无折扣</option>
                <option value="98折">98折</option>
                <option value="95折">95折</option>
                <option value="85折">85折</option>
                <option value="79折">79折</option>
            </select>
        </td>
        <td></td>
    </tr>
    <tr>
        <td></td>
        <td><button type="button">提交</button></td>
        <td></td>
    </tr>
</table>

</body>
</html>
<script>
    $(function () {
        getAll();
    });
    function getAll() {
        $.get("/getAll.do",function (data) {
            console.log("data：",data);
            $("#tb").html("你妈个大蛤蟆");
            let str = "";
            data.forEach(book=>{
                str += "<tr>";
                str += "<td>"+book.bookid+"</td>";
                str += "<td>"+book.bookname+"</td>";
                str += "<td>"+book.bookauthor+"</td>";
                str += "<td>"+book.publisher+"</td>";
                str += "<td>"+book.saleprice+"</td>";
                str += "<td>"+book.discname+"</td>";
                str += "<td>"+book.disprice+"</td>";
                str += "<td>"+book.storecount+"</td>";
                str += "<td>";
                str += "<a href='#'>折扣设置</a>";
                str += "</td>";
                str += "</tr>";
            })
            $("#tb").html(str);
        })
    }
</script>